#ifndef __DRV_SERIAL_PORT_H
#define __DRV_SERIAL_PORT_H
#include <stdbool.h>
#include <stdint.h>
#include <stddef.h>
#include "drv_common_def.h"
#ifdef __cplusplus
extern "C" {
#endif

typedef void (*SerialReadCallBack)(const uint8_t *buf, size_t len);

typedef struct SerialPort_t SerialPort;
struct SerialPort_t {
    errno_t (*write)(SerialPort *pthis, const uint8_t *buf, size_t len);
    errno_t (*setReadCallBack)(SerialPort *pthis, SerialReadCallBack func);
    errno_t (*read)(SerialPort *pthis, uint8_t *buf, uint32_t *len);
    void (*remove)(SerialPort *pthis);
};

SerialPort *GetDebugSerialPort(void);

void SetDebugSerialPort(SerialPort *serialPort);

errno_t SetDebugSerialPortCallback(SerialReadCallBack func);

void DebugUartCallBack(const uint8_t *buf, size_t len);

#ifdef __cplusplus
}
#endif
#endif